﻿@using CVsharp.Models.Entities
@{
    ViewBag.Title = "权限管理";
    Layout = "~/Views/Shared/Dwz/_DwzPageLayout.cshtml";
}
<link href="../../Scripts/ligerUI/skins/Aqua/css/ligerui-menu.css" rel="stylesheet"
    type="text/css" />
<script src="../../Scripts/ligerUI/js/plugins/ligerMenu.js" type="text/javascript"></script>
<div id="resultBox">
</div>
<div class="divider">
</div>
<div class="tabs">
    <div class="tabsHeader">
        <div class="tabsHeaderContent">
            <ul>
                <li><a href="javascript:;"><span>权限管理</span></a></li>
                
            </ul>
        </div>
    </div>
    <div class="tabsContent">
        <div>
            <div layouth="100" style="float: left; display: block; overflow: auto; width: 200px;
                border: solid 1px #99BBE8; line-height: 21px; background: #fff; margin-right: 10px;">
                <div class="panelBar">
                    <ul class="toolBar">
                        <li class=""><a class="add"  target="dialog" href="@Url.Action("AddRole")"><span>添加角色</span>
                        </a></li>
                        <li><a class="delete" id="SetAccountDelRole"><span>删除</span></a></li>
                    </ul>
                </div>
                <div id="SetAccountRolesTreeDiv">
                </div>
            </div>
            <div id="SetAccountPermissionTreeDiv" layouth="100" style="display: block; overflow: auto; width: 350px; border: solid 1px #99BBE8;
                line-height: 21px; background: #fff;">

            </div>
  
            <div id="jbsxBox" class="unitBox" style="margin-left: 246px;">
                <!--#include virtual="list1.html" -->
            </div>
        </div>
    </div>
    <div class="tabsFooter">
        <div class="tabsFooterContent">
        </div>
    </div>
</div>
<script type="text/javascript">
    //刷新角色树
    function RolesTreeLoad(json){
        $("#SetAccountRolesTreeDiv").ajaxUrl({
				type:"POST", url:"@Url.Action("RolesTree")", callback:function(response){               
                    $("#SetAccountRolesTreeDiv #RolesTree").ligerTree({ checkbox: false, nodeWidth: 155 }); //构建角色树
				}						
			});       
            if(json)DWZ.ajaxDone(json);    
     }
    RolesTreeLoad();
    //刷新权限树
    function PermissionTreeLoad(json){
        $("#SetAccountPermissionTreeDiv").ajaxUrl({
		    type:"POST", url:"@Url.Action("PermissionTree")", callback:function(response){               
                $("#SetAccountPermissionTreeDiv #PermissionTree").ligerTree({ checkbox: true, nodeWidth: 280}); //构建权限树
		    }						
	    });       
        if(json)DWZ.ajaxDone(json);    
    }
    PermissionTreeLoad();

    $("#SetAccountDelRole").click(function () {
    	alertMsg.confirm("确定要删除吗？", {
		     okCall: function(){
			var Roletext = $("#SetAccountRolesTreeDiv #RolesTree").ligerGetTreeManager().getSelected().data.text;
            $.post("@Url.Action("DelRole")",
            {                
                RoleName:Roletext
            },
            function (data){
            RolesTreeLoad(data); 
            },
            "json");
            event.preventDefault();
		    }
	    });    
    });
    //弹出菜单
    /*
    var menu;
    var actionNodeID;
    function itemclick(item, i)
    {
        alert(actionNodeID + " | " + item.text);
    }
    menu = $.ligerMenu({ top: 100, left: 800, width: 120, items:
    [
    { text: '增加', click: itemclick, icon: 'add' },
    { text: '修改', click: itemclick },
    { line: true },
    { text: '查看', click: itemclick }
    ]
    });
         
    //构建权限树
    $("#treeAccount").ligerTree({checkbox: true,nodeWidth: 300,onContextmenu: function (node, e)
    {
        actionNodeID = node.data.text;
        menu.show({ top: e.pageY, right: e.pageX });
        return false;
    }
    });
    */ 
</script>
